﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Store.Master" Inherits="System.Web.Mvc.ViewPage<NDepot.Models.UI.CartInput>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="SideContent" runat="server">
<div id="cart">
<% if (Model.Cart.Items.Count != 0)
   { %>
        <% Html.RenderPartial("Cart", Model.Cart); %>
<%} %>
</div>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h1><%: NDepot.Resources.CatalogTitle %></h1>

    <% foreach (var item in Model.Products) { %>
        <div class="entry">    
            <%: item.ImageUrl%>
            <h3><%: item.Title %></h3>
            <%: item.Description %>    
            <div class="price-line">
                <span class="price"><%: String.Format("{0:F}", item.Price) %></span>
            </div>

            <% using (Ajax.BeginForm("AddToCart/" + item.Id,
                   new AjaxOptions { UpdateTargetId = "cart", InsertionMode = InsertionMode.Replace, HttpMethod = "GET", OnSuccess= "HighLightCurrentItem" }))
               { %>            
                <input type="submit" value="<%: NDepot.Resources.AddToCart %>" />
            <% } %>
        </div>
    <% } %>

    <script type="text/javascript">
        function HighLightCurrentItem() {
            $("div#notice").hide();
            $("#current_item").effect("highlight", {}, 1000);
        }
    </script>
</asp:Content>

